<?php
namespace app\common\model;

use think\Model;

class CategoryModel extends Model
{
    //指定主键
    protected $pk = 'category_id';
    //指定表名
    protected $table = 'ds_category';

    /**
     * @date 2019/7/4 17:16
     * @description 获取分类所有数据列表
     * @author cxh
     * @param int $count
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function get_category_all_list($where=[],$count = 0) {
        if ($count > 0) {
            $result['count'] = $this->table('ds_category')->where($where)->count();
        } else {
            $result = $this
                ->table('ds_category')
                ->where($where)
                ->order('category_id desc')
                ->field('*')
                ->select()
                ->toArray();
        }
        return $result;
    }




}
